home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 October / The Sunday Times - The Month 2004-10.iso / pc / assets / bespoke / kids / cartoon.swf / scripts / frame_1 / DoAction.as
Text File  |  2004-05-26  |  2KB  |  82 lines

  1. var ASSETS = "../../../../../html/issue11/assets/";
  2. XMLdata = new XML();
  3. XMLdata.ignoreWhite = true;
  4. XMLdata.onLoad = function(success)
  5. {
  6.    if(success)
  7.    {
  8.       init();
  9.    }
  10.    else
  11.    {
  12.       trace("!!! Problem loading XML...");
  13.    }
  14. };
  15. if(Tardis)
  16. {
  17.    XMLdata.load(Tardis.ASSETS_FOLDER + "bespoke/kids/cartoon.xml");
  18. }
  19. else
  20. {
  21.    XMLdata.load("cartoon.xml");
  22. }
  23. init = function()
  24. {
  25.    gotoAndStop(2);
  26.    if(Tardis)
  27.    {
  28.       filePath = Tardis.ASSETS_FOLDER;
  29.    }
  30.    else
  31.    {
  32.       filePath = ASSETS;
  33.    }
  34.    filePath += XMLdata.firstChild.attributes.filepath;
  35.    currentPage = 1;
  36.    pageCount = XMLdata.firstChild.childNodes.length;
  37.    XMLdata.page = XMLdata.firstChild.firstChild;
  38.    showPage();
  39. };
  40. closeCartoon = function()
  41. {
  42.    Tardis.OverlayController.removeLastOverlay();
  43. };
  44. navigate = function(pPageModifier)
  45. {
  46.    if(pPageModifier > 0)
  47.    {
  48.       XMLdata.page = XMLdata.page.nextSibling;
  49.       currentPage++;
  50.    }
  51.    else
  52.    {
  53.       XMLdata.page = XMLdata.page.previousSibling;
  54.       currentPage--;
  55.    }
  56.    showPage();
  57. };
  58. showPage = function()
  59. {
  60.    if(!pageHolder_mc)
  61.    {
  62.       createEmptyMovieClip("pageHolder_mc",1);
  63.    }
  64.    var _loc1_ = filePath + XMLdata.page.firstChild.nodeValue;
  65.    pageHolder_mc.loadMovie(_loc1_);
  66.    updateButtons();
  67. };
  68. updateButtons = function()
  69. {
  70.    mc_controls.forward_btn._visible = true;
  71.    mc_controls.back_btn._visible = true;
  72.    if(currentPage == 1)
  73.    {
  74.       mc_controls.back_btn._visible = false;
  75.    }
  76.    if(currentPage == pageCount)
  77.    {
  78.       mc_controls.forward_btn._visible = false;
  79.    }
  80. };
  81. stop();
  82.